% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/proxistat2-DRAFT.R
\name{proxistat2}
\alias{proxistat2}
\title{Calculate a proximity score for every blockgroup - DRAFT WORK IN PROGRESS}
\usage{
proxistat2(pts, countradius = 8.04672, maxradius = 621.3712, quadtree = NULL)
}
\arguments{
\item{pts}{data.table of lat lon}

\item{countradius}{distance within in which nearby sites are counted to create proximity score.
In miles, and default is 5km (8.04672 miles)
which is the EJScreen zone for proximity scores based on counts.}

\item{maxradius}{max distance in miles to search for nearest single facility,
if none found within countradius. EJScreen seems to use 1,000 km as the max to search,
since the lowest scores for proximity scores of RMP, TSDF, or NPL are around 0.001,
meaning approx. 1/1000 km and km_per_mile = 1.609344
so 1000 km is 1000 / 1.609344 = 621.3712 miles}

\item{quadtree}{must be called localtree, an index of block locations,
built during use of EJAM package. see \link{quaddata}}
}
\value{
data.table with proximityscore, bgfips, lat, lon, etc.
}
\description{
Indicator of proximity of each blockgroups to some set of facilities or sites.
also see getfrsnearby()
}
\details{
Proximity score is sum of (1/d) where each d is distance of a given site in km,
summed over all sites within 5km, as in EJScreen.

getblocksnearbyviaQuadTree.R() and maybe doaggregate()?

has a bit of code in it to do some of what this function does.
}
\examples{
 # pts <- testpoints_100
 # x <- proxistat2(pts = pts[1:1000,], quadtree = localtree) 
 #
 # summary(x$proximityscore)
 # # analyze.stuff   pctiles(x$proximityscore)
 # plot(x = x$lon, y = x$lat)
 # tops = x$proximityscore > 500 & !is.infinite(x$proximityscore) & !is.na(x$proximityscore)
 # points(x = x$lon[tops], y = x$lat[tops], col="red")
 
}
